function [absmaxtab]=abspeakdet(v, delta, x)
% function that returns the positive and
% negative peaks in the same array
% see peakdet()

if nargin < 3
  x = (1:length(v))';
else 
  x = x(:);
  if length(v)~= length(x)
    error('Input vectors v and x must have same length');
  end
end

[maxtab, mintab] = peakdet(v, delta, x);

absmaxtab =  vertcat(maxtab, mintab);

absmaxtab = sort(absmaxtab,1,'ascend');

end